Skip to content

Conversation

@ianayl
Copy link
Contributor

@ianayl ianayl commented Jul 9, 2025

Bad / nonsensical values in SYCL_PARALLEL_FOR_RANGE_ROUNDING_PARAMS result in division by 0 crashes. This PR:

  • Adds guards to check that range rounding factors are set to sensical values
  • Adds test to ensure only valid range rounding factors can be set

@ianayl ianayl requested a review from a team as a code owner July 9, 2025 22:54
@ianayl ianayl requested a review from slawekptak July 9, 2025 22:54
@ianayl ianayl temporarily deployed to WindowsCILock July 9, 2025 22:54 — with GitHub Actions Inactive
@ianayl ianayl temporarily deployed to WindowsCILock July 9, 2025 23:21 — with GitHub Actions Inactive
@ianayl ianayl temporarily deployed to WindowsCILock July 9, 2025 23:21 — with GitHub Actions Inactive
Copy link
Contributor

@AlexeySachkov AlexeySachkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have a test added for the change

@ianayl ianayl temporarily deployed to WindowsCILock July 10, 2025 20:23 — with GitHub Actions Inactive
@ianayl ianayl temporarily deployed to WindowsCILock July 10, 2025 20:51 — with GitHub Actions Inactive
@ianayl ianayl temporarily deployed to WindowsCILock July 10, 2025 20:51 — with GitHub Actions Inactive
@ianayl ianayl temporarily deployed to WindowsCILock July 11, 2025 21:42 — with GitHub Actions Inactive
@ianayl ianayl temporarily deployed to WindowsCILock July 11, 2025 22:08 — with GitHub Actions Inactive
@ianayl ianayl temporarily deployed to WindowsCILock July 11, 2025 22:08 — with GitHub Actions Inactive
@ianayl ianayl temporarily deployed to WindowsCILock July 11, 2025 22:33 — with GitHub Actions Inactive
@ianayl ianayl temporarily deployed to WindowsCILock July 11, 2025 23:00 — with GitHub Actions Inactive
@ianayl ianayl temporarily deployed to WindowsCILock July 11, 2025 23:00 — with GitHub Actions Inactive
@ianayl ianayl temporarily deployed to WindowsCILock July 14, 2025 17:19 — with GitHub Actions Inactive
@ianayl ianayl temporarily deployed to WindowsCILock July 14, 2025 17:46 — with GitHub Actions Inactive
@ianayl ianayl temporarily deployed to WindowsCILock July 14, 2025 17:46 — with GitHub Actions Inactive
@ianayl ianayl temporarily deployed to WindowsCILock July 14, 2025 19:39 — with GitHub Actions Inactive
@ianayl ianayl temporarily deployed to WindowsCILock July 14, 2025 20:11 — with GitHub Actions Inactive
@ianayl ianayl temporarily deployed to WindowsCILock July 14, 2025 20:11 — with GitHub Actions Inactive
@ianayl
Copy link
Contributor Author

ianayl commented Jul 17, 2025

@intel/llvm-reviewers-runtime PR ready for review, thanks in advance!

if (Pos != std::string::npos) {
MF = std::stoi(Params.substr(0, Pos));
if (Pos != std::string::npos && GuardedStoi(MF, Params.substr(0, Pos)) &&
MF > 0) {
Copy link
Contributor

@cperkinsintel cperkinsintel Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be MF >= 0 ( GTE instead of GT) ? 0 is a valid return from GuardedStoi, no? Or maybe 0 should not be valid in GuardedStoi.

Copy link
Contributor Author

@ianayl ianayl Jul 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way we currently have range rounding, MF=0 results in a division by zero error: This PR helps prevent the crash that would happen as a result.

I don't think it makes sense anyway, as according to https://github.com/intel/llvm/blob/970e2ef386e6287202cbaf69ff3871889bed5959/sycl/doc/EnvironmentVariables.md, the minimum factor is the "range that the rounded range should be a multiple of (Default 16)": Rounding parallel_for ranges to a multiple of 0 should probably not be possible. Thus, I have a test case to explicitly check that MF=0 should not be accepted.

@ianayl ianayl requested a review from cperkinsintel July 24, 2025 20:10
@ianayl
Copy link
Contributor Author

ianayl commented Jul 30, 2025

@cperkinsintel Mind if I ask you to take a look again? Thanks!

@ianayl
Copy link
Contributor Author

ianayl commented Aug 11, 2025

@intel/llvm-gatekeepers PR is ready for merge, thanks!

@sarnex
Copy link
Contributor

sarnex commented Aug 11, 2025

Can you add a PR description?

@ianayl
Copy link
Contributor Author

ianayl commented Aug 11, 2025

Can you add a PR description?

Done 👍

@sarnex sarnex merged commit 2c6a397 into intel:sycl Aug 11, 2025
26 checks passed
@sarnex
Copy link
Contributor

sarnex commented Aug 11, 2025

Thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants